*Figure 2

cd "/Users/kevin/Dropbox/TZ ITNs"
set more off
set varabbrev off

use "constructed data/for_analysis.dta", clear

cd "/Users/kevin/Dropbox/TZ ITNs/plots"


 *Fig 2: 
  foreach y in $approve {  
bys time_since_ucc: egen mean_`y'=mean(`y')
twoway (lpoly `y' time_since_ucc if time_since_ucc<-15 & sample==1, lcolor(black) clwidth(thick)) ///
 (lpoly `y' time_since_ucc if time_since_ucc>15 & sample==1, ///
lcolor(black) clwidth(thick)) ///
(scatter mean_`y' time_since_ucc, msize(vsmall) color(gray)) ///
if (time_since_ucc>15 | time_since_ucc<-15) & sample==1, ///
 title(`variable label `y'', color(black)) xline(-15 15, lpattern(dash) ///
 lcolor(black)) legend(off) ylabel(, nogrid) xtitle(days since ITN distribution, size(medlarge)) ///
 ytitle(% approve `y', size(medlarge)) yscale(r(0 1)) ylabel(0(0.2)1) ///
subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ///
 ifcolor(white) ilcolor(white)) xlabel(-365(100)365) xline(-90 90, lpattern(dash) lcolor(gs12))
graph save Graph "`y'.gph", replace
}

graph combine "village_chair.gph" "village_exec.gph" "ward_exec.gph" ///
"councillor.gph" "mp.gph", ///
rows(2) cols(2) subtitle(, color(black) fcolor(white) lcolor(white)) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))
